//
//  UserTableViewCell.m
//  XRSquare
//
//  Created by UaenaMo on 2018/8/8.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "UserTableViewCell.h"

@interface UserTableViewCell ()
{
    UILabel * userName;
    UIImageView * avatar;
    UILabel * lable;
}
@end

@implementation UserTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        userName = [[UILabel alloc]initWithFrame:CGRectMake(15, 20, ScreenWidth, 20)];
        userName.font = [UIFont boldSystemFontOfSize:18];
        userName.textColor = [UIColor grayColor];
        [self addSubview:userName];
        
        avatar = [[UIImageView alloc]initWithFrame:CGRectMake(ScreenWidth - 70, 20, 50, 50)];
        avatar.layer.cornerRadius = 25;
        avatar.backgroundColor = [UIColor blackColor];
        avatar.clipsToBounds = YES;
        [self addSubview:avatar];
        
        lable = [[UILabel alloc]initWithFrame:CGRectMake(15, 50, ScreenWidth, 20)];
        lable.font = [UIFont systemFontOfSize:15];
        lable.text = @"查看并编辑个人资料";
        [self addSubview:lable];
    }
    return self;
}

+(CGFloat)height
{
    return 80;
}

-(void)loadData:(NSDictionary *)data
{
    if (data) {
        userName.text = [data objectForKey:@"Name"];
        [avatar sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",[data objectForKey:@"PicURL"],[data objectForKey:@"HeadPic"]]]];
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
